<jsp:directive.page import="java.sql.*"/>
<jsp:directive.page import="Connectivity.ConnectionManager"/>
<%@ include file="/other/Header.jsp" %>
 <%
String status = request.getParameter("status")!=null?request.getParameter("status"):"null";
		String image_name = session.getAttribute("image_name").toString();//? (session.getAttribute("image_name").toString()):"spacer.gif";
String path1 = "/container/images/";
String basePath1 = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path1+"/";
 
 %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'EmpRegistration.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<link rel="stylesheet" type="text/css" media="all" href="<%=basePath%>other/jsDatePick_ltr.min.css" />
    <script type="text/javascript" src="<%=basePath%>other/jsDatePick.min.1.3.js"></script>
     <script type="text/javascript" src="<%=basePath%>other/data.js"></script>
  </head>
  <script>
  function mySubmit()
  {
   
  document.registration.action="/Genius/EmpRegister?submit=Update";
  document.registration.submit();
  }
  function stopSpecialEmailChar()
	{
		if((window.event.keyCode >= 33  && window.event.keyCode <= 45) || (window.event.keyCode >= 47  && window.event.keyCode < 48) || (window.event.keyCode > 57  && window.event.keyCode <= 63) || window.event.keyCode == 96 || window.event.keyCode == 32 || (window.event.keyCode >= 91  && window.event.keyCode <= 94) || (window.event.keyCode >= 123  && window.event.keyCode <= 126)){
	   		window.event.keyCode = 0;
			}
	}
	
function copyAddress(){
	var address= document.frmRegistration.tempAddress.value;
	document.frmRegistration.perAddress.value=address;
	}
function isEmailId(string) 
{
	//alert("in function _isEmailId");
	if(string.search(/^[A-Za-z](([A-Za-z0-9])|(\.[A-Za-z0-9])|(\_[A-Za-z0-9]))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/)!= -1)	
		return true;
	else
		return false;
}
  function copyfile(source,destination)
  {
   copyFileSync = (srcFile, destFile)
   BUF_LENGTH = 64*1024; 
   buff = new Buffer(BUF_LENGTH);  
   fdr = fs.openSync(srcFile, 'r');  
   fdw = fs.openSync(destFile, 'w')  
   bytesRead = 1; 
   pos = 0; 
   while (bytesRead > 0) 
   {bytesRead = fs.readSync(fdr, buff, 0, BUF_LENGTH, pos)  
   fs.writeSync(fdw,buff,0,bytesRead)  
   pos += bytesRead } 
   fs.closeSync(fdr)  
   fs.closeSync(fdw) 
  }
  </script>
  
  <script>
  // width to resize large images to
var maxWidth=160;
  // height to resize large images to
var maxHeight=160;
  // valid file types
var fileTypes=["bmp","gif","png","jpg","jpeg"];
  // the id of the preview image tag
var outImage="previewField";
  // what to display when the image is not valid
var defaultPic="spacer.gif";

function preview(what)
{
var source=what.value;

var ext=source.substring(source.lastIndexOf(".")+1,source.length).toLowerCase();

 for (var i=0; i<fileTypes.length; i++) 
 {
 if (fileTypes[i]==ext) 
 {break;}}
 if (i<fileTypes.length)
 {
 //copyfile(source,destination);
 window.location.href="/Genius/form/employee/up.jsp?uploadfile="+source;
 }
  else
 { alert("THAT IS NOT A VALID IMAGE\nPlease load an image with an extention of one of the following:\n\n"+fileTypes.join(", "));}
 }
</script>


<%

		String loginid = request.getParameter("loginid")!=null?request.getParameter("loginid"):"";
		String firstname = session.getAttribute("fname").toString();
		//String emp_eid = session.getAttribute("emp_eid").toString();
		String middlename = session.getAttribute("mname").toString();
		String lastname = session.getAttribute("lname").toString();
		String cellnumber = session.getAttribute("cellnumber").toString();
		String bdate = session.getAttribute("bdate").toString();
		String gender = session.getAttribute("gender").toString();
		String jdate = session.getAttribute("jdate").toString();
		String experience = session.getAttribute("experience").toString();
		
		

		String mothername = request.getParameter("mothername")!=null?request.getParameter("mothername"):"";
		String religion = request.getParameter("religion")!=null?request.getParameter("religion"):"";
		String caste = request.getParameter("caste")!=null?request.getParameter("caste"):"";
		String subCaste = request.getParameter("subCaste")!=null?request.getParameter("subCaste"):"";
		String bgroup = request.getParameter("bgroup")!=null?request.getParameter("bgroup"):"";
		String birth_place = request.getParameter("birth_place")!=null?request.getParameter("birth_place"):"PUNE";

		
		String tempAddress = request.getParameter("tempAddress")!=null?request.getParameter("tempAddress"):"";
		String perAddress = request.getParameter("perAddress")!=null?request.getParameter("perAddress"):"";
		String area = request.getParameter("area")!=null?request.getParameter("area"):"";

		String marital_status = request.getParameter("marital_status")!=null?request.getParameter("marital_status"):"2";
		String identification = request.getParameter("identification")!=null?request.getParameter("identification"):"";
		String emailid = request.getParameter("emailid")!=null?request.getParameter("emailid"):"";
		String qualification = request.getParameter("qualification")!=null?request.getParameter("qualification"):"";
		
		
		String dlicense = request.getParameter("dlicense")!=null?request.getParameter("dlicense"):"2";
		String pcard = request.getParameter("pcard")!=null?request.getParameter("pcard"):"";

		String role_eid = session.getAttribute("role_eid").toString();

String check="checked";

 %>











  <body>
  <form name=registration method=get action="/Genius/EmpRegister">
  
<TABLE  style="POSITION: absolute; DISPLAY: inline; TOP: 280px; LEFT: 980px; zIndex: 200" id=4 width=160 height=110>
 <TR>
 <TD><img alt="Graphic will preview here" id="previewField" src="<%=basePath1+""+image_name%>" width=160 height=160> </TD>
 </TR>
</TABLE>
   
<TABLE class=maintable border=1 cellSpacing=1 align=center>
 <TBODY>
  <%
    if(status.equalsIgnoreCase("I"))
    {
    out.println("  <tr><td align=center width=100% colspan=10><font size=4 color=black> INSERTED SUCCESSFULLY </font> </td></tr>");
    }
     if(status.equalsIgnoreCase("U"))
    {
    out.println("  <tr><td align=center width=100% colspan=10><font size=4 color=black> UPDATED SUCCESSFULLY </font> </td></tr>");
    }
     if(status.equalsIgnoreCase("D"))
    {
    out.println("  <tr><td align=center width=100% colspan=10><font size=4 color=black> DELETED SUCCESSFULLY </font> </td></tr>");
    }
     %>
 
 
 
 
 
 
 
   <TR>
     <TD  colSpan=4 align=middle><B>Staff Registration</B></TD></TR>
   <TR>
   <TD  colSpan=4 align=middle>Fields marked with an asterisk <FONT color=red>*</FONT> are mandatory.</FONT></TD></TR>
   <TR>
     <TD  width="19%" align=left><B>Login ID : <FONT color=red>*</FONT></B> </TD>
          <TD  width="81%"><INPUT readonly maxLength=20 size=30 name=loginid value=<%=loginid%>> </TD></TR>
         <TR>
          <TD  width="19%" align=left><B>First Name : <FONT 
            color=red>*</FONT></B> </TD>
          <TD  width="81%"><INPUT  maxLength=50   size=30 name=fname value=<%=firstname%>> </TD></TR>
        <TR>
          <TD  width="19%" align=left><B>Middle Name : <FONT color=red>*</FONT></B> </TD>
          <TD  width="81%"><INPUT  maxLength=50   size=30 name=mname value=<%=middlename %>> </TD></TR>
        <TR>
          <TD  width="19%" align=left><B>Last Name : <FONT 
            color=red>*</FONT></B> </TD>
          <TD  width="81%"><INPUT maxLength=50  size=30 name=lname value=<%=lastname%>> </TD></TR>
        <TR>
          <TD  width="19%" align=left><B>Mother's Name :</B> </TD>
          <TD  width="81%"><INPUT  maxLength=50  size=30 name=mothername value=<%=mothername%>> </TD></TR>
        <TR>
          <TD  align=left><B>Religion :</B></TD>
          <TD  colSpan=2 align=left><INPUT maxLength=15   size=30 name=religion value=<%=religion%>> </TD></TR>
        <TR>
          <TD  align=left><B>Caste :</B> </TD>
          <TD  colSpan=2 align=left><INPUT maxLength=30 size=30 name=caste value=<%=caste%>> </TD></TR>
        <TR>
          <TD  align=left><B>Sub Caste :</B> </TD>
          <TD  colSpan=2 align=left><INPUT maxLength=30 size=30 name=subCaste value=<%=subCaste%>> </TD></TR>
        <TR>
          <TD  width="19%" align=left><B>Blood Group :</B> </TD>
          <TD  width="81%" colSpan=2><INPUT  maxLength=10 size=30 name=bgroup value=<%=bgroup%>> </TD></TR>
        <TR>
          <TD  width="19%" align=left><B>Gender : <FONT 
            color=red>*</FONT></B> </TD>
          <TD  width="81%" colSpan=2>
            <%if(gender.equalsIgnoreCase("M")){%>
          <INPUT value=M type=radio checked name=gender><B>Male </B>
          <INPUT value=F type=radio name=gender><B>Female</B>
          <%}else{ %>
          <INPUT value=M type=radio  name=gender><B>Male </B>
          <INPUT value=F type=radio checked name=gender><B>Female</B>
          
          <%} %> </TD>
          </TR>
        <TR>
          <TD  width="19%" align=left><B>Date Of Birth : <FONT 
            color=red>*</FONT></B></TD>
          <TD  width="81%" colSpan=2><input type="text" readonly size="12" name=bdate value="<%=bdate%>"/>
           </TD></TR>
        <TR>
          <TD  width="19%" align=left><B>Temporary Address : 
</B></TD>
          <TD  width="81%" colSpan=2>
          <TEXTAREA  rows=4 cols=35 name=tempAddress></TEXTAREA> 
            <A href="javascript:copyAddress()"><FONT color=blue><U>Copy Address 
            To Permanent</U></FONT></A> </TD></TR>
        <TR>
          <TD  width="19%" align=left><B>Permanent Address : </B> </TD>
          <TD  width="81%" colSpan=2><TEXTAREA  rows=4 cols=35 name=perAddress></TEXTAREA> 
          </TD></TR>
        <TR>
          <TD  width="19%" align=left><B>Area :</B> </TD>
          <TD  width="81%" colSpan=2><INPUT maxLength=50  size=30 name=area> </TD></TR>
        <TR>
          <TD  width="19%" align=left><B>Pin Code :</B> </TD>
          <TD  width="81%" colSpan=2><INPUT  maxLength=6 size=30 name=pcode> </TD></TR>
        <TR>
          <TD  width="19%" align=left><B>Phone Number :</B> </TD>
          <TD  width="81%" colSpan=2><INPUT maxLength=4 size=3 name=country value="+91"> <B>- 
            </B><INPUT  maxLength=5 size=5 name=state value="020"> <B>- 
            </B><INPUT  maxLength=8 size=10   name=phnumber> </TD></TR>
        <TR>
          <TD  width="19%" align=left><B>Alternate Phone Number 
            :</B> </TD>
          <TD  width="81%" colSpan=2><INPUT maxLength=4 size=3 name=country value="+91"> <B>- 
            </B><INPUT  maxLength=5 size=5 name=state value="020"> <B>- 
            </B><INPUT  maxLength=8 size=10   name=phnumber1> </TD></TR>
        <TR>
          <TD  width="19%" align=left><B>Cell Number : <FONT color=red>*</FONT></B> </TD>
          <TD  width="81%" colSpan=2><INPUT maxLength=4 size=5 name=isd value="+91"> <B>- </B>
          <INPUT  maxLength=10 size=15 name=cellnumber value="<%=cellnumber%>"></TD></TR>
        <TR>
          <TD  width="39%" align=left><B>Marital Status :<FONT 
            color=red> *</FONT></B> </TD>
          <TD  width="81%" colSpan=2><SELECT 
             name=marital_status> <OPTION selected 
              value=0>--Select--</OPTION> <OPTION value=S>Single</OPTION> 
              <OPTION value=M>Married</OPTION> <OPTION 
            value=W>Widowed</OPTION></SELECT> </TD></TR> 
        
        <TR>
          <TD  width="19%" align=left><B>Identification :</B> </TD>
          <TD  width="81%" colSpan=2><INPUT  maxLength=50  size=40 name=identification> </TD></TR>
       
        <TR>
          <TD  width="39%" align=left><B>Email ID :</B> </TD>
          <TD  width="81%" colSpan=2><INPUT 
            onkeypress=stopSpecialEmailChar(); maxLength=50 size=40 
            name=emailid> </TD></TR>
        <TR>
          <TD  width="39%" align=left><B>Qualification : </B> </TD>
          <TD  width="81%" colSpan=2><INPUT
            maxLength=100 size=40 name=qualification> </TD></TR>
        <TR>
          <TD  width="39%" align=left><B>Experience : </B> </TD>
          <TD  width="81%" colSpan=2><INPUT maxLength=4 size=30 name=experience value=<%=experience%>/>
        </TR>

        <TR>
          <TD  width="39%" align=left><B>Service Joining Date : <FONT color=red>*</FONT></B> 
          </TD>
          <TD  width="81%" colSpan=2><%=jdate%></TD></TR>
        <TR>
           <TD  width="19%" align=left><B>Driving License :  </B> </TD>
          <TD  width="81%"><INPUT  maxLength=20     size=30 name=dlicense> </TD></TR>
            <TR>
           <TD  width="19%" align=left><B>PAN CARD :  </B> </TD>
          <TD  width="81%"><INPUT  maxLength=20  size=30 name=pcard> </TD></TR>   
            <TR>
           <TD  width="19%" align=left><B>Introducer name : <FONT color=red>*</FONT></B> </TD>
          <TD  width="81%"><INPUT  maxLength=20  size=30 name=iname> </TD></TR>  
             <TR>
           <TD  width="19%" align=left><B>Account at:  </B> </TD>
          <TD  width="81%"><INPUT maxLength=20  size=30 name=iname> </TD></TR>  
            <TD  width="19%" align=left><B>Account No.: </B> </TD>
          <TD  width="81%"><INPUT  maxLength=20  size=30 name=iname> </TD></TR>  
        <TR>
          <TD  width="39%" align=left><B>Role : <FONT color=red>*</FONT></B> </TD>
          <TD  width="81%" colSpan=2><SELECT size=1 name=roleId> 
              <%if(role_eid.equals("3")){ %>
	              <OPTION value=3 selected> Sr.EMPLOYEE</OPTION>
              <%}if(role_eid.equals("2")) {%>
              <OPTION value=2 selected> Jr.EMPLOYEE</OPTION>
              <%} %>
              </SELECT> </TD></TR>

        
          <TD  width="39%" align=left>&nbsp; </TD>
          <TD  width="39%" align=left>
		<!--  <INPUT class=btn onclick=EditorOnUploadImage(this.photoPath); value="Upload Photo" type=button name=B3>&nbsp;&nbsp;&nbsp;&nbsp; -->
           <input class=btn type="file" id="picField" onchange="preview(this)" value="Upload Photo">           
           
		 <!--  <INPUT onfocus=showPhoto() readOnly name=photoPath>
		   <IMG 
            onclick=javascript:removeAttachments(); 
            src="/ETH/DCSIS_E/Form/Activity_files/minus.gif">(Remove Photo) --></TD></TR>
        <TR>
          <TD  width="100%" colSpan=3 align=right>
            <P align=center><B><INPUT  onclick=mySubmit(); value=Submit type=button name=B1> 
<INPUT  value=Reset type=reset name=B2></B> 
        </P></TD></TR></TBODY>
        <input type= hidden name=image_name value='<%=image_name%>'>
    
    </table>
    </form>         
  </body>
    <script type="text/javascript">
	window.onload = function()
	{ new JsDatePick({useMode:2,target:"inputField",dateFormat:"%d-%M-%Y"
			/*selectedDate:{				This is an example of what the full configuration offers.
				day:5,						For full documentation about these settings please see the full version of the code.
				month:9,
				year:2006
			},
			yearsRange:[1978,2020],
			limitToToday:false,
			cellColorScheme:"beige",
			dateFormat:"%m-%d-%Y",
			imgPath:"img/",
			weekStartDay:1*/
		});
	};
	
</script>
</html>
